package com.sss.hloster0103;

public class Student implements Comparable{
//属性
	private String stuName;
	private String stuNum;
	private int stuAge;
	private double stuScore;
	public Student() {
		super();
	}
	public Student(String stuName, String stuNum, int stuAge, double stuScore) {
		super();
		this.stuName = stuName;
		this.stuNum = stuNum;
		this.stuAge = stuAge;
		this.stuScore = stuScore;
	}
	//行为
	/**
	 * 学习行为
	 */
	public void doStuding() {
		System.out.println(this.stuName+"   is   studing....");
	}
	@Override
	public int compareTo(Object stu) {
		//比较此对象与指定对象的顺序。如果该对象小于、等于或大于指定对象，则分别返回负整数，零或正整数
		//默认返回值（相等）
		int i_re = 0;
		//学生排序的比较（按成绩排序）
		if(stu ==null) {
			//被比较对象为null，表示大于它，返回1
			i_re= 1;
		}else if(this.getStuScore()>((Student)stu).getStuScore()) {
			//大于情况
			i_re =1;
		}else if(this.getStuScore()<((Student)stu).getStuScore()) {
			//小于情况
			i_re=-1;
		}
		return i_re*-1;
	}
	public String getStuName() {
		return stuName;
	}
	public void setStuName(String stuName) {
		this.stuName = stuName;
	}
	public String getStuNum() {
		return stuNum;
	}
	public void setStuNum(String stuNum) {
		this.stuNum = stuNum;
	}
	public int getStuAge() {
		return stuAge;
	}
	public void setStuAge(int stuAge) {
		this.stuAge = stuAge;
	}
	public double getStuScore() {
		return stuScore;
	}
	public void setStuScore(double stuScore) {
		this.stuScore = stuScore;
	}
	@Override
	public String toString() {
		return "Student [stuName=" + stuName + ", stuNum=" + stuNum + ", stuAge=" + stuAge + ", stuScore=" + stuScore
				+ "]";
	}

}
